#include "StdAfx.h"
#include "base/util/string_util.h"

namespace ui{
	bool kvItem::Filter(const std::wstring& sFilter, bool ignoreCase, bool filterKey) const{
		if (sFilter.empty())
			return true;
		std::wstring sValue = ignoreCase ? StringHelper::MakeLowerString(v) : v;
		bool ret = sValue.find(sFilter) != std::wstring::npos;
		if (!ret && filterKey)
		{
			std::string k_ = ignoreCase ? StringHelper::MakeLowerString(k) : k;
			std::string filter_ = nbase::UTF16ToUTF8(sFilter);
			ret = k_.find(filter_) != std::string::npos;
		}
		return ret;
	}
}

